package com.bee.caf_ss_android.common;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * 本地存储
 */
public class LocalStorage {

    private SharedPreferences sp ;
    private  SharedPreferences.Editor editor ;

    public LocalStorage(Context context){
        sp = context.getSharedPreferences("beeMarket_s", Context.MODE_PRIVATE);
        editor = sp.edit();
    }

    /**
     * 清除所有信息
     */
    public void cleanAll(){
        editor.clear() ;
        editor.commit() ;
    }
    /**
     * 清除所有信息,出了电话号码
     */
    public void cleanAllOutPhone(){
        String phone = getPhone() ;
        editor.clear() ;
        editor.commit() ;
        setPhone(phone);
    }
    /***********-----------门店销售人员登录token---------******/
    private String tokenKey = "token" ;
    public String getToken(){
        return sp.getString(tokenKey,"") ;
    }

    public void  setToken(String tokenVal){
        editor.putString(tokenKey,tokenVal) ;
        editor.commit() ;
    }

    /***********-----------门店销售人员ID---------******/
    /*private String saleIdKey = "saleId" ;
    public String getSaleId(){
        return sp.getString(saleIdKey,"") ;
    }
    public void setSaleId(String saleIdVal){
        editor.putString(saleIdKey,saleIdVal) ;
        editor.commit() ;
    }*/
    private String counselorIdKey = "saleId" ;
    public String getCounselorId(){
        return sp.getString(counselorIdKey,"") ;
    }
    public void setCounselorId(String counselorIdVal){
        editor.putString(counselorIdKey,counselorIdVal) ;
        editor.commit() ;
    }

    /***********-----------登录手机号码---------******/
    private String phoneKey = "phone" ;
    public String getPhone(){
        return sp.getString(phoneKey,"") ;
    }

    public void  setPhone(String phoneVal){
        editor.putString(phoneKey,phoneVal) ;
        editor.commit() ;
    }

    /***********-----------登录顾问姓名---------******/
    private String counselorNameKey = "counselorNam" ;
    public String getCounselorName(){
        return sp.getString(counselorNameKey,"") ;
    }

    public void  setCounselorName(String counselorNameVal){
        editor.putString(counselorNameKey,counselorNameVal) ;
        editor.commit() ;
    }

    /***********-----------登录顾问门店---------******/
    private String counselorShopNameKey = "counselorShopName" ;
    public String getCounselorShopName(){
        return sp.getString(counselorShopNameKey,"") ;
    }

    public void  setCounselorShopName(String counselorShopNameVal){
        editor.putString(counselorShopNameKey,counselorShopNameVal) ;
        editor.commit() ;
    }
}
